package com.fesine.learn;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by Administrator on 2017/4/15.
 * 启动dubbo服务用的MainClass
 */
public class DubboProvider {

    private static final Log log = LogFactory.getLog(DubboProvider.class);

    public static void main(String[] args) {
        try {

            ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("classpath:spring.xml");
            System.out.println("=============================进入");

            context.start();

        } catch (Exception e) {
            log.error("----->dubbo服务启动失败:", e);

        }

        synchronized (DubboProvider.class) {
            while (true) {

                try {
                    log.info("----->服务已经启动！");
                    DubboProvider.class.wait();

                } catch (InterruptedException e) {
                    log.error("----->同步报错", e);

                }

            }

        }
    }
}
